﻿<navigation:PageView x:Class="Corina.Cydee.Apphub.Views.Users.PendingView"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                     xmlns:localViewmodel="clr-namespace:Corina.Cydee.Apphub.Viewmodels"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:navigation="clr-namespace:Corina.Cydee.Apphub.Base"
                     xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                     xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
                     Title="新注册用户"
                     d:DesignHeight="480"
                     d:DesignWidth="640"
                     mc:Ignorable="d">
    <navigation:PageView.DataContext>
        <localViewmodel:PendingUserViewmodel />
    </navigation:PageView.DataContext>
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>

        <toolkit:BusyIndicator BusyContent="{StaticResource IDS_BUSYCONTENT_LOADING}" IsBusy="{Binding IsBusy}">
            <sdk:DataGrid AutoGenerateColumns="False"
                          ColumnWidth="*"
                          IsReadOnly="True"
                          ItemsSource="{Binding ItemsCollection}"
                          ScrollViewer.VerticalScrollBarVisibility="Auto">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn MinWidth="150"
                                            Binding="{Binding Account}"
                                            Header="帐号" />
                    <sdk:DataGridTextColumn MinWidth="150"
                                            Binding="{Binding Name}"
                                            Header="姓名" />
                    <sdk:DataGridTextColumn MinWidth="150"
                                            Binding="{Binding Kind}"
                                            Header="帐户类型" />
                    <sdk:DataGridTextColumn MinWidth="200"
                                            Binding="{Binding RegisterTime,
                                                              StringFormat=\{0:yyyy-MM-dd HH:mm:ss tt\}}"
                                            Header="注册时间" />
                    <sdk:DataGridTextColumn MinWidth="150"
                                            Binding="{Binding Industry}"
                                            Header="行业" />
                    <sdk:DataGridTemplateColumn MinWidth="150" Header="操作">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel VerticalAlignment="Center" Orientation="Horizontal">
                                    <HyperlinkButton Content="批准">
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="Click">
                                                <i:InvokeCommandAction Command="{Binding Path=DataContext.ApproveCommand, RelativeSource={RelativeSource AncestorType=navigation:PageView}}" CommandParameter="{Binding Id}" />
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </HyperlinkButton>
                                    <HyperlinkButton Content="删除">
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="Click">
                                                <i:InvokeCommandAction Command="{Binding Path=DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=navigation:PageView}}" CommandParameter="{Binding Id}" />
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </HyperlinkButton>
                                </StackPanel>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
        </toolkit:BusyIndicator>

        <Button Grid.Row="1"
                Width="75"
                HorizontalAlignment="Right"
                Command="{Binding RefreshCommand}"
                Content="刷新" />

    </Grid>
</navigation:PageView>
